﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Schema;
using System.IO;

namespace GenIX
{
    public partial class EditXmlForm : Form
    {
        // <Events>
        // ======================= События ===================================
        //</Events>

        // <LoadXmlForm>
        // При загрузке формы
        // </LoadXmlForm>
        private void EditXmlForm_Load(object sender, EventArgs e)
        {
            Parsing();
            //Highlight();
        }

        // <SaveButton>
        // При Сохранении
        // </SaveButton>
        private void save_Click(object sender, EventArgs e)
        {
            MainForm Frm1 = this.Owner as MainForm;

            StreamWriter streamwriter =
              new System.IO.StreamWriter(Frm1.filename, false, System.Text.Encoding.GetEncoding("utf-8"));
            streamwriter.Write(this.xmlRichTextBox.Text);
            streamwriter.Close();

        }

        // <CancelButton>
        // При Отмене
        // </CancelButtonButton>
        private void cancel_Click(object sender, EventArgs e)
        {
            Close();
            //Highlight();
        }

        // <copyText>
        // При Копировании
        // </copyText>
        private void copyTextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            xmlRichTextBox.Copy();
        }

        // <pasteText>
        // При Вставке
        // </pasteText>
        private void pasteTextToolStripMenuItem_Click(object sender, EventArgs e)
        {
            xmlRichTextBox.Paste();
        }

        // <redo>
        // При Вернуть
        // </redo>
        private void redoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            xmlRichTextBox.Redo();
        }

        // <undo>
        // При Отменить
        // </undo>
        private void undoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            xmlRichTextBox.Undo();
        }

    }
}